#include <iostream>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int main() {
    auto triangle_number = [](int num) {
        int a = sqrt(2 * num);
        int b = a + 1;
        return a * (a + 1) / 2 == num || b * (b + 1) / 2 == num;
    };
    auto word_value = [](const string& s) {
        int r = 0;
        for (char c : s)
            r += c - 'A' + 1;
        return r;
    };
    const vector<string> words { 
#include "42.txt" 
    };
    int r = 0;
    for (auto word : words) {
        if (triangle_number(word_value(word)))
            ++r;
    }
    cout << r << endl; // 166
}